package com.enniu.alipay.api.data.util;

import org.springframework.util.Assert;

public class DataSourceSwitcher {

	private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();

	public static void set(String dataSource) {
	    System.out.println("切换到  "+dataSource+"数据库");
		Assert.notNull(dataSource, "dataSource cannot be null");
		contextHolder.set(dataSource);
	}

	public static String get() {
		return (String) contextHolder.get();
	}
}
